var express = require('express');
var router = express.Router();
const mysql=require('mysql');
const connection=require('../public/javascripts/mysql');
/* GET home page. */
router.get('/', function(req, res, next) {
    connection.query('SELECT * FROM address', (error, results, fields) => {

        res.json(results);


    });
});
router.post('/id', function(req, res, next) {
    connection.query('SELECT * FROM boklist where id=?', [req.query.id],(error, results, fields) => {

        res.json(results);


    });
});
router.post('/fabu', function(req, res, next) {
    console.log(req.query.name,req.query.content,req.query.id)
    connection.query('UPDATE boklist SET name=?,content=?  WHERE id=?', [req.query.name,req.query.content,req.query.id],(error, results, fields) => {


    });
});
module.exports = router;
